package org.example.src.repository;

import org.example.src.entity.Teacher;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

@Repository
public interface TeacherRepository extends JpaRepository<Teacher, Long> {
    Optional<Teacher> findByTeacherId(String teacherId);

    @Query("SELECT t FROM Teacher t WHERE t.department = :department")
    List<Teacher> findByDepartment(@Param("department") String department);

    @Query("SELECT t FROM Teacher t WHERE t.fullName LIKE %:name%")
    List<Teacher> findByNameContaining(@Param("name") String name);
}